import { WorkflowPageParams, WorkflowPageResult } from './model/index';
import { defHttp } from '/@/utils/http/axios';

import { ErrorMessageMode } from '/#/axios';

enum Api {
  ProcessMonitorPage = '/workflow/execute/process-monitor/page',
  SetSuspended = '/workflow/execute/set-suspended',
}

/**
 * @description: 查询流程监控列表
 */
export async function getProcessMonitorPage(
  params: WorkflowPageParams,
  mode: ErrorMessageMode = 'modal',
) {
  return defHttp.get<WorkflowPageResult>(
    {
      url: Api.ProcessMonitorPage,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * @description: 将流程挂起或者恢复
 */

export async function postSetSuspended(processId, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<boolean>(
    {
      url: Api.SetSuspended,
      params: { processId },
    },
    {
      errorMessageMode: mode,
    },
  );
}
